"use client"
import Link from "next/link"
import { usePathname } from "next/navigation"
import { useState } from "react"
import "./styles.css"
const linkList = [
    { name: 'shop1页面', url: '/shop1' },
    { name: 'shop2页面', url: '/shop2' },
]
export default function ShopDetailsLayout({
    children,
}: {
    children: React.ReactNode
}) {
    const pathname = usePathname()
    const [value, setValue] = useState<string>('')
    return (

        <>
            <p>layout的数据</p><input type="text" value={value} onChange={(e) => setValue(e.target.value)} />
            {linkList.map((item, index) => {
                const isactive = pathname === item.url || (pathname.startsWith(item.url)) && item.url !== "/"
                console.log(isactive)
                return (
                    <Link className={isactive ? "haha" : ''} href={item.url} key={index}>{item.name}</Link>
                )
            })}
            {children}
            <footer>Shop页面的也叫</footer>
        </>




    )
}